<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <base href="<%=request.getContextPath()%>/"/>
    <script src="js/jquery.min.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.js"></script>
    <link href="css/bootstrap.css" rel="stylesheet">
</head>
<body>
    请输入要发布的消息:<input type="text" id="text"><br/>
    请选着广播的方式:<select id="select">
                        <option value="public" selected="selected">公共广播</option>
                        <option value="1">单点广播</option>
                  </select>
    <button id="submit">发布</button>
</body>
</html>
<script>
    $("#submit").click(function(){
        var message = $("#text").val();
        var principal = $("#select").val();
        $.post("websocket/publish",{
                message:message,
                principal:principal
        },function (data) {
            if(data.success){
                console.log(data.message);
            }else{
                console.log(data.message);
            }
        })
    })
</script>